package com.yunban.project.message.controller;

import com.yunban.project.message.service.WeChatService;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import net.lab1024.sa.base.common.annoation.NoNeedLogin;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author: lijiajun
 * @date: 2025-04-02
 * @version: 1.0
 */
@Controller
@Tag(name = "微信登录")
public class WeChatLoginController {

    @Resource
    private WeChatService weChatService;

    @NoNeedLogin
    @GetMapping("/login/wechat")
    public void loginByWechat(@RequestParam("callback") String callback, HttpServletResponse response) {
        this.weChatService.loginByWechat(callback, response);
    }

    @NoNeedLogin
    @GetMapping("/login/wechat/callback")
    public void weChatCallback(HttpServletRequest request, HttpServletResponse response) {
        this.weChatService.weChatCallback(request, response);
    }

}
